{smcl}
{com}{sf}{ul off}{txt}{.-}
       log:  {res}all countries.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res} 9 Jan 2011, 15:52:07

{com}. do "C:\Users\Piotr\AppData\Local\Temp\STD06000000.tmp"
{txt}
{com}. * ESTIMATING AR(p) BY CLASS
. 
. *** ALL COUNTRIES ***
. 
. use REGRESSION\All_all.dta, clear
{txt}
{com}. 
. *** All incidents
. 
. *MIPT
. sum mAll

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
        mAll {c |}{res}       160    63.98125    29.98941          6        208
{txt}
{com}. * Checking autocorrelations
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mAll, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-744.0697{col 48}    3{col 57} 1494.139{col 69} 1503.365
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-741.7864{col 48}    4{col 57} 1491.573{col 69} 1503.873
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-741.7339{col 48}    5{col 57} 1493.468{col 69} 1508.844
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-738.3418{col 48}    6{col 57} 1488.684{col 69} 1507.135
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-735.4652{col 48}    7{col 57}  1484.93{col 69} 1506.457
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-733.1658{col 48}    8{col 57} 1482.332{col 69} 1506.933
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-732.8818{col 48}    9{col 57} 1483.764{col 69}  1511.44
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-732.8702{col 48}   10{col 57}  1485.74{col 69} 1516.492
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(6) according to AIC and AR(1) according to BIC
. * Parsimonity --> estimating AR(1)
. 
. regress mAll L.mAll FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     159
                                                       {help j_robustsingular:F(  5,   152) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.3615
                                                       {txt}Root MSE      = {res} 24.349

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
        mAll {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
        mAll {c |}
         L1. {c |}  {res} .3687114   .1041464     3.54   0.001     .1629499    .5744729
        {txt}FUND {c |}  {res} 22.01316   5.846046     3.77   0.000     10.46316    33.56315
        {txt}POST {c |}  {res}-20.38458   5.714548    -3.57   0.000    -31.67478   -9.094381
        {txt}SEPT {c |}  {res} 15.71744   9.405205     1.67   0.097    -2.864365    34.29925
          {txt}Dp {c |}  {res} 7.257661   9.249062     0.78   0.434    -11.01565    25.53098
        {txt}IRAQ {c |}  {res} -8.05351   11.82595    -0.68   0.497    -31.41797    15.31095
       {txt}_cons {c |}  {res} 31.38529   5.570182     5.63   0.000     20.38031    42.39026
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mAll_pred
{txt}(option xb assumed; fitted values)
(1 missing value generated)

{com}. line mAll mAll_pred Quarter
{res}{txt}
{com}. drop mAll_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   152) ={res}   20.26
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(1 missing value generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    3.3770
{txt} Prob > chi2({res}4{txt})            = {res}    0.4968
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. * No zero values --> no need to add c
. gen lmAll=ln(mAll)
{txt}
{com}. nbreg mAll L.lmAll FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-1087.9962{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-1087.9939{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-1087.9939{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-822.11714{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-786.54961{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res} -759.7655{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-759.71818{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-759.71817{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-724.21219{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-714.60938{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-710.69316{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-710.68345{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-710.68345{txt}  

Negative binomial regression                      Number of obs   =  {res}      159
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}5{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-710.68345                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}        mAll{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}       lmAll{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2}  .566854{col 26}{space 2} .0825088{col 37}{space 1}    6.87{col 46}{space 3}0.000{col 55}{space 3} .4051397{col 67}{space 3} .7285683
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .2252644{col 26}{space 2} .0835121{col 37}{space 1}    2.70{col 46}{space 3}0.007{col 55}{space 3} .0615836{col 67}{space 3} .3889451
{col 1}{text}        POST{col 14}{c |}{result}{space 2} -.201496{col 26}{space 2} .0843721{col 37}{space 1}   -2.39{col 46}{space 3}0.017{col 55}{space 3}-.3668624{col 67}{space 3}-.0361297
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .1850055{col 26}{space 2}  .132174{col 37}{space 1}    1.40{col 46}{space 3}0.162{col 55}{space 3}-.0740509{col 67}{space 3} .4440618
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .2596669{col 26}{space 2} .1234919{col 37}{space 1}    2.10{col 46}{space 3}0.035{col 55}{space 3} .0176272{col 67}{space 3} .5017067
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2} -.117448{col 26}{space 2} .1630895{col 37}{space 1}   -0.72{col 46}{space 3}0.471{col 55}{space 3}-.4370974{col 67}{space 3} .2022015
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.718074{col 26}{space 2} .3164777{col 37}{space 1}    5.43{col 46}{space 3}0.000{col 55}{space 3} 1.097789{col 67}{space 3} 2.338359
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-2.196938{col 27}{space 1} .1622806{col 55}{space 3}-2.515002{col 67}{space 3}-1.878874
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2}  .111143{col 27}{space 1} .0180363{col 55}{space 3} .0808628{col 67}{space 3} .1527621
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mAll]L.lmAll = 0
{txt} ( 2)  {res}[mAll]FUND = 0
{txt} ( 3)  {res}[mAll]POST = 0
{txt} ( 4)  {res}[mAll]SEPT = 0
{txt} ( 5)  {res}[mAll]Dp = 0
{txt} ( 6)  {res}[mAll]IRAQ = 0

           {txt}chi2(  6) ={res}  139.09
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mAll_pred
{txt}(option n assumed; predicted number of events)
(1 missing value generated)

{com}. line mAll mAll_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mAll]SEPT = 0
{txt} ( 2)  {res}[mAll]Dp = 0

{txt}{col 12}chi2(  2) ={res}   46.93
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mAll-mAll_pred)/sqrt( mAll_pred*(1+mAll_pred*s2) )
{txt}(1 missing value generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    5.5705
{txt} Prob > chi2({res}4{txt})            = {res}    0.2336
{txt}
{com}. drop nbresidual mAll_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mAll L.lmAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-759.7182{col 37}-710.6834{col 48}    7{col 57} 1435.367{col 69} 1456.849
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mAll L.mAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-765.3052{col 37}-729.6404{col 48}    6{col 57} 1471.281{col 69} 1489.694
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mAll L.mAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-759.7182{col 37}-724.1659{col 48}    7{col 57} 1462.332{col 69} 1483.814
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mAll L.mAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-1561.343{col 37}-1179.383{col 48}    6{col 57} 2370.765{col 69} 2389.179
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop lmAll
{txt}
{com}. 
. *ITERATE
. sum iAll

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
        iAll {c |}{res}       160    80.66875    46.28918          9        315
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iAll, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-812.9782{col 48}    3{col 57} 1631.956{col 69} 1641.182
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-803.8073{col 48}    4{col 57} 1615.615{col 69} 1627.915
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-799.2835{col 48}    5{col 57} 1608.567{col 69} 1623.943
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-798.5856{col 48}    6{col 57} 1609.171{col 69} 1627.622
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-796.9016{col 48}    7{col 57} 1607.803{col 69} 1629.329
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-796.8965{col 48}    8{col 57} 1609.793{col 69} 1634.394
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-795.5414{col 48}    9{col 57} 1609.083{col 69} 1636.759
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-795.2131{col 48}   10{col 57} 1610.426{col 69} 1641.178
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Parsimonity --> estimating AR(3)
. 
. regress iAll L(1/3).iAll FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     157
                                                       {help j_robustsingular:F(  7,   148) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.4572
                                                       {txt}Root MSE      = {res} 34.933

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
        iAll {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
        iAll {c |}
         L1. {c |}  {res} .1663172   .1222614     1.36   0.176    -.0752863    .4079207
         {txt}L2. {c |}  {res} .1433604   .0928261     1.54   0.125    -.0400753    .3267962
         {txt}L3. {c |}  {res} .1358158    .083401     1.63   0.106    -.0289949    .3006265
        {txt}FUND {c |}  {res} 17.62123   9.269483     1.90   0.059     -.696408    35.93886
        {txt}POST {c |}  {res}-29.67822   11.52548    -2.58   0.011    -52.45399    -6.90245
        {txt}SEPT {c |}  {res}-10.69507   9.250583    -1.16   0.249    -28.97536    7.585211
          {txt}Dp {c |}  {res}-23.71888    6.47188    -3.66   0.000    -36.50811   -10.92965
        {txt}IRAQ {c |}  {res} -8.72385   7.304896    -1.19   0.234    -23.15922    5.711518
       {txt}_cons {c |}  {res}  47.5174   10.46942     4.54   0.000     26.82855    68.20624
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iAll_pred
{txt}(option xb assumed; fitted values)
(3 missing values generated)

{com}. line iAll iAll_pred Quarter
{res}{txt}
{com}. drop iAll_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   148) ={res}   15.23
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(3 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.4687
{txt} Prob > chi2({res}4{txt})            = {res}    0.9765
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. * No zero values --> no need to add c
. gen liAll=ln(iAll)
{txt}
{com}. nbreg iAll L(1/3).liAll FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-1364.9288{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-1363.2631{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-1363.2472{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-1363.2472{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-849.09158{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-821.04614{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-811.96899{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-811.96069{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-811.96069{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-765.75586{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-740.36971{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-738.57184{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-738.53513{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-738.53512{txt}  

Negative binomial regression                      Number of obs   =  {res}      157
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}7{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-738.53512                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}        iAll{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}       liAll{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .3592537{col 26}{space 2} .1002814{col 37}{space 1}    3.58{col 46}{space 3}0.000{col 55}{space 3} .1627057{col 67}{space 3} .5558016
{col 1}{text}         L2.{col 14}{c |}{result}{space 2}  .235371{col 26}{space 2} .0777296{col 37}{space 1}    3.03{col 46}{space 3}0.002{col 55}{space 3} .0830238{col 67}{space 3} .3877183
{col 1}{text}         L3.{col 14}{c |}{result}{space 2} .0178926{col 26}{space 2} .0886759{col 37}{space 1}    0.20{col 46}{space 3}0.840{col 55}{space 3}-.1559089{col 67}{space 3} .1916942
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .1297646{col 26}{space 2} .0857097{col 37}{space 1}    1.51{col 46}{space 3}0.130{col 55}{space 3}-.0382233{col 67}{space 3} .2977525
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.2591608{col 26}{space 2} .1135154{col 37}{space 1}   -2.28{col 46}{space 3}0.022{col 55}{space 3}-.4816469{col 67}{space 3}-.0366748
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2}-.0162783{col 26}{space 2} .2141479{col 37}{space 1}   -0.08{col 46}{space 3}0.939{col 55}{space 3}-.4360005{col 67}{space 3} .4034439
{col 1}{text}          Dp{col 14}{c |}{result}{space 2}-.8897529{col 26}{space 2} .1863579{col 37}{space 1}   -4.77{col 46}{space 3}0.000{col 55}{space 3}-1.255008{col 67}{space 3}-.5244981
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.2868067{col 26}{space 2} .1927463{col 37}{space 1}   -1.49{col 46}{space 3}0.137{col 55}{space 3}-.6645824{col 67}{space 3} .0909691
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.758565{col 26}{space 2} .4684422{col 37}{space 1}    3.75{col 46}{space 3}0.000{col 55}{space 3} .8404351{col 67}{space 3} 2.676695
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-2.043139{col 27}{space 1} .1716612{col 55}{space 3}-2.379588{col 67}{space 3}-1.706689
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .1296212{col 27}{space 1} .0222509{col 55}{space 3} .0925887{col 67}{space 3} .1814657
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iAll]L.liAll = 0
{txt} ( 2)  {res}[iAll]L2.liAll = 0
{txt} ( 3)  {res}[iAll]L3.liAll = 0
{txt} ( 4)  {res}[iAll]FUND = 0
{txt} ( 5)  {res}[iAll]POST = 0
{txt} ( 6)  {res}[iAll]SEPT = 0
{txt} ( 7)  {res}[iAll]Dp = 0
{txt} ( 8)  {res}[iAll]IRAQ = 0

           {txt}chi2(  8) ={res} 4753.78
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iAll_pred
{txt}(option n assumed; predicted number of events)
(3 missing values generated)

{com}. line iAll iAll_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iAll]SEPT = 0
{txt} ( 2)  {res}[iAll]Dp = 0

{txt}{col 12}chi2(  2) ={res}   38.15
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iAll-iAll_pred)/sqrt( iAll_pred*(1+iAll_pred*s2) )
{txt}(3 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.8210
{txt} Prob > chi2({res}4{txt})            = {res}    0.9356
{txt}
{com}. drop nbresidual iAll_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iAll L(1/3).liAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-811.9607{col 37}-738.5351{col 48}    9{col 57}  1495.07{col 69} 1522.576
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iAll L(1/3).iAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-823.9973{col 37}-776.0296{col 48}    8{col 57} 1568.059{col 69} 1592.509
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iAll L(1/3).iAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-811.9607{col 37}-748.7536{col 48}    9{col 57} 1515.507{col 69} 1543.013
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iAll L(1/3).iAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-2476.804{col 37}-1462.469{col 48}    8{col 57} 2940.938{col 69} 2965.388
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop liAll
{txt}
{com}. 
. *** Casualty incidents
. 
. *MIPT
. sum mCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
   mCasualty {c |}{res}       160    22.24375    13.19365          1         66
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -577.894{col 48}    3{col 57} 1161.788{col 69} 1171.014
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-571.8427{col 48}    4{col 57} 1151.685{col 69} 1163.986
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-571.6951{col 48}    5{col 57}  1153.39{col 69} 1168.766
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-571.4412{col 48}    6{col 57} 1154.882{col 69} 1173.333
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-570.9948{col 48}    7{col 57}  1155.99{col 69} 1177.516
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-570.9462{col 48}    8{col 57} 1157.892{col 69} 1182.494
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -570.591{col 48}    9{col 57} 1159.182{col 69} 1186.859
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-570.5839{col 48}   10{col 57} 1161.168{col 69}  1191.92
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(2) according to AIC and AR(2) according to BIC
. * Estimating AR(2)
. 
. regress mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.5883
                                                       {txt}Root MSE      = {res} 8.5771

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
   mCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
   mCasualty {c |}
         L1. {c |}  {res}   .48296   .0939853     5.14   0.000     .2972541     .668666
         {txt}L2. {c |}  {res} .2306389   .0886536     2.60   0.010     .0554678    .4058101
        {txt}FUND {c |}  {res} 3.678458   2.109858     1.74   0.083    -.4904216    7.847338
        {txt}POST {c |}  {res}-2.258852   1.836328    -1.23   0.221    -5.887261    1.369558
        {txt}SEPT {c |}  {res} 5.530292   4.292145     1.29   0.200    -2.950581    14.01116
          {txt}Dp {c |}  {res} 10.82482   4.301471     2.52   0.013     2.325523    19.32412
        {txt}IRAQ {c |}  {res}-3.406319   5.193297    -0.66   0.513    -13.66778    6.855145
       {txt}_cons {c |}  {res} 4.157448   1.199225     3.47   0.001     1.787894    6.527003
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mCasualty_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line mCasualty mCasualty_pred Quarter
{res}{txt}
{com}. drop mCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}   90.97
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.6540
{txt} Prob > chi2({res}4{txt})            = {res}    0.9569
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. * No zero values --> no need to add c
. gen lmCasualty=ln(mCasualty)
{txt}
{com}. nbreg mCasualty L(1/2).lmCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-610.78838{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-610.52476{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res} -610.5247{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-653.43912{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-625.72426{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-623.94294{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-623.94158{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-623.94158{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-576.55884{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-548.06538{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-543.59016{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-543.41262{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-543.41236{txt}  
Iteration 5:{col 16}log pseudolikelihood = {res}-543.41236{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-543.41236                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}   mCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}  lmCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .4381811{col 26}{space 2} .0951801{col 37}{space 1}    4.60{col 46}{space 3}0.000{col 55}{space 3} .2516315{col 67}{space 3} .6247306
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .2635503{col 26}{space 2} .0842204{col 37}{space 1}    3.13{col 46}{space 3}0.002{col 55}{space 3} .0984814{col 67}{space 3} .4286193
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .1365706{col 26}{space 2} .1052234{col 37}{space 1}    1.30{col 46}{space 3}0.194{col 55}{space 3}-.0696635{col 67}{space 3} .3428046
{col 1}{text}        POST{col 14}{c |}{result}{space 2} -.102736{col 26}{space 2} .0750167{col 37}{space 1}   -1.37{col 46}{space 3}0.171{col 55}{space 3} -.249766{col 67}{space 3}  .044294
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .2158632{col 26}{space 2} .1306137{col 37}{space 1}    1.65{col 46}{space 3}0.098{col 55}{space 3} -.040135{col 67}{space 3} .4718614
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .5410997{col 26}{space 2}  .132934{col 37}{space 1}    4.07{col 46}{space 3}0.000{col 55}{space 3} .2805538{col 67}{space 3} .8016455
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2} -.115868{col 26}{space 2}  .158636{col 37}{space 1}   -0.73{col 46}{space 3}0.465{col 55}{space 3}-.4267889{col 67}{space 3}  .195053
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} .8799577{col 26}{space 2} .1983065{col 37}{space 1}    4.44{col 46}{space 3}0.000{col 55}{space 3} .4912841{col 67}{space 3} 1.268631
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-2.371243{col 27}{space 1} .2000992{col 55}{space 3} -2.76343{col 67}{space 3}-1.979056
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .0933646{col 27}{space 1} .0186822{col 55}{space 3}  .063075{col 67}{space 3} .1381997
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mCasualty]L.lmCasualty = 0
{txt} ( 2)  {res}[mCasualty]L2.lmCasualty = 0
{txt} ( 3)  {res}[mCasualty]FUND = 0
{txt} ( 4)  {res}[mCasualty]POST = 0
{txt} ( 5)  {res}[mCasualty]SEPT = 0
{txt} ( 6)  {res}[mCasualty]Dp = 0
{txt} ( 7)  {res}[mCasualty]IRAQ = 0

           {txt}chi2(  7) ={res}  276.75
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mCasualty_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line mCasualty mCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mCasualty]SEPT = 0
{txt} ( 2)  {res}[mCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}  106.96
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mCasualty-mCasualty_pred)/sqrt( mCasualty_pred*(1+mCasualty_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.8696
{txt} Prob > chi2({res}4{txt})            = {res}    0.9289
{txt}
{com}. drop nbresidual mCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mCasualty L(1/2).lmCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-623.9416{col 37}-543.4124{col 48}    8{col 57} 1102.825{col 69} 1127.325
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-629.7599{col 37}-559.6453{col 48}    7{col 57} 1133.291{col 69} 1154.729
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-623.9416{col 37}  -558.81{col 48}    8{col 57}  1133.62{col 69} 1158.121
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-1003.169{col 37}-657.0358{col 48}    7{col 57} 1328.072{col 69}  1349.51
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop lmCasualty
{txt}
{com}. 
. *ITERATE
. sum iCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
   iCasualty {c |}{res}       160    23.91875    12.51162          2         57
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-591.0274{col 48}    3{col 57} 1188.055{col 69}  1197.28
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-579.0006{col 48}    4{col 57} 1166.001{col 69} 1178.302
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-577.1047{col 48}    5{col 57} 1164.209{col 69} 1179.585
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-576.5643{col 48}    6{col 57} 1165.129{col 69}  1183.58
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-575.3817{col 48}    7{col 57} 1164.763{col 69}  1186.29
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-574.4533{col 48}    8{col 57} 1164.907{col 69} 1189.508
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-573.8774{col 48}    9{col 57} 1165.755{col 69} 1193.431
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-573.6782{col 48}   10{col 57} 1167.356{col 69} 1198.108
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(3) according to AIC and AR(2) according to BIC
. * Parsimonity --> estimating AR(2)
. 
. regress iCasualty L(1/2).iCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.4857
                                                       {txt}Root MSE      = {res} 9.1047

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
   iCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
   iCasualty {c |}
         L1. {c |}  {res} .3545612   .0776294     4.57   0.000     .2011729    .5079494
         {txt}L2. {c |}  {res} .3398772   .0939848     3.62   0.000     .1541721    .5255823
        {txt}FUND {c |}  {res} 2.780081   2.266924     1.23   0.222    -1.699145    7.259308
        {txt}POST {c |}  {res}-2.868534   2.447427    -1.17   0.243    -7.704418    1.967349
        {txt}SEPT {c |}  {res}-.2618595   2.622211    -0.10   0.921      -5.4431    4.919381
          {txt}Dp {c |}  {res}-.5563077   2.171947    -0.26   0.798    -4.847869    3.735253
        {txt}IRAQ {c |}  {res}-1.431772   2.883418    -0.50   0.620    -7.129132    4.265589
       {txt}_cons {c |}  {res} 6.774306   1.795575     3.77   0.000     3.226419    10.32219
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iCasualty_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line iCasualty iCasualty_pred Quarter
{res}{txt}
{com}. drop iCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}    0.11
{txt}{col 13}Prob > F ={res}    0.8980
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    2.2092
{txt} Prob > chi2({res}4{txt})            = {res}    0.6974
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. * No zero values --> no need to add c
. gen liCasualty=ln(iCasualty)
{txt}
{com}. nbreg iCasualty L(1/2).liCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-631.50438{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-631.49099{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-631.49099{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-664.35609{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-621.54661{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res} -615.2627{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-615.26126{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-615.26126{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-574.61988{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-559.87482{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-555.55734{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-555.46816{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-555.46813{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-555.46813                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}   iCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}  liCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .4019837{col 26}{space 2} .0651886{col 37}{space 1}    6.17{col 46}{space 3}0.000{col 55}{space 3} .2742163{col 67}{space 3}  .529751
{col 1}{text}         L2.{col 14}{c |}{result}{space 2}  .300219{col 26}{space 2} .0725036{col 37}{space 1}    4.14{col 46}{space 3}0.000{col 55}{space 3} .1581146{col 67}{space 3} .4423234
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .0760087{col 26}{space 2} .0819387{col 37}{space 1}    0.93{col 46}{space 3}0.354{col 55}{space 3}-.0845883{col 67}{space 3} .2366056
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.0848348{col 26}{space 2} .0846234{col 37}{space 1}   -1.00{col 46}{space 3}0.316{col 55}{space 3}-.2506936{col 67}{space 3}  .081024
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .0242038{col 26}{space 2} .1698659{col 37}{space 1}    0.14{col 46}{space 3}0.887{col 55}{space 3}-.3087272{col 67}{space 3} .3571347
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .1452527{col 26}{space 2} .1675121{col 37}{space 1}    0.87{col 46}{space 3}0.386{col 55}{space 3}-.1830649{col 67}{space 3} .4735703
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.1261873{col 26}{space 2} .1807314{col 37}{space 1}   -0.70{col 46}{space 3}0.485{col 55}{space 3}-.4804144{col 67}{space 3} .2280397
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} .9734346{col 26}{space 2} .1959233{col 37}{space 1}    4.97{col 46}{space 3}0.000{col 55}{space 3}  .589432{col 67}{space 3} 1.357437
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-2.385263{col 27}{space 1} .1841843{col 55}{space 3}-2.746257{col 67}{space 3}-2.024268
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .0920648{col 27}{space 1} .0169569{col 55}{space 3} .0641676{col 67}{space 3} .1320905
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iCasualty]L.liCasualty = 0
{txt} ( 2)  {res}[iCasualty]L2.liCasualty = 0
{txt} ( 3)  {res}[iCasualty]FUND = 0
{txt} ( 4)  {res}[iCasualty]POST = 0
{txt} ( 5)  {res}[iCasualty]SEPT = 0
{txt} ( 6)  {res}[iCasualty]Dp = 0
{txt} ( 7)  {res}[iCasualty]IRAQ = 0

           {txt}chi2(  7) ={res} 1481.40
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iCasualty_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line iCasualty iCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iCasualty]SEPT = 0
{txt} ( 2)  {res}[iCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}    1.81
{txt}{col 10}Prob > chi2 =  {res}  0.4052
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iCasualty-iCasualty_pred)/sqrt( iCasualty_pred*(1+iCasualty_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    3.7603
{txt} Prob > chi2({res}4{txt})            = {res}    0.4394
{txt}
{com}. drop nbresidual iCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iCasualty L(1/2).liCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-615.2613{col 37}-555.4681{col 48}    8{col 57} 1126.936{col 69} 1151.437
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iCasualty L(1/2).iCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-621.6111{col 37} -569.077{col 48}    7{col 57} 1152.154{col 69} 1173.592
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iCasualty L(1/2).iCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-615.2613{col 37}-563.8926{col 48}    8{col 57} 1143.785{col 69} 1168.286
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iCasualty L(1/2).iCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-899.1339{col 37}-659.1111{col 48}    7{col 57} 1332.222{col 69}  1353.66
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop liCasualty
{txt}
{com}. 
. *** US target incidents
. 
. *MIPT
. sum mUS_Target

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
  mUS_Target {c |}{res}       160       17.95    12.23193          0         99
{txt}
{com}. tab Quarter if mUS_Target==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     2007:3 {c |}{res}          1       50.00       50.00
{txt}     2007:4 {c |}{res}          1       50.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          2      100.00
{txt}
{com}. *No such incidents in 2007:3 and 2007:4 makes it necessary to use Poisson estimation as well.
. *But first I'm trying OLS
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mUS_Target, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-616.2653{col 48}    3{col 57} 1238.531{col 69} 1247.756
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-607.4045{col 48}    4{col 57} 1222.809{col 69}  1235.11
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -606.971{col 48}    5{col 57} 1223.942{col 69} 1239.318
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-602.6613{col 48}    6{col 57} 1217.323{col 69} 1235.774
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-599.3975{col 48}    7{col 57} 1212.795{col 69} 1234.321
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-599.2346{col 48}    8{col 57} 1214.469{col 69} 1239.071
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-599.0487{col 48}    9{col 57} 1216.097{col 69} 1243.774
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-599.0452{col 48}   10{col 57}  1218.09{col 69} 1248.842
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(5) according to AIC and AR(5) according to BIC
. * Estimating AR(5)
. 
. regress mUS_Target L(1/5).mUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     155
                                                       {help j_robustsingular:F(  9,   144) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.3625
                                                       {txt}Root MSE      = {res}  10.16

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
  mUS_Target {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
  mUS_Target {c |}
         L1. {c |}  {res} .0539103   .1053881     0.51   0.610    -.1543972    .2622179
         {txt}L2. {c |}  {res} .1431865   .0705647     2.03   0.044     .0037102    .2826629
         {txt}L3. {c |}  {res}-.1015189   .0950555    -1.07   0.287    -.2894031    .0863654
         {txt}L4. {c |}  {res}  .164353   .0785921     2.09   0.038     .0090098    .3196962
         {txt}L5. {c |}  {res} .1956526   .1344804     1.45   0.148     -.070158    .4614632
        {txt}FUND {c |}  {res}  4.23228   2.355032     1.80   0.074    -.4226182    8.887178
        {txt}POST {c |}  {res}  -10.384   2.694701    -3.85   0.000    -15.71028   -5.057725
        {txt}SEPT {c |}  {res} 3.950843   2.649226     1.49   0.138    -1.285551    9.187236
          {txt}Dp {c |}  {res} 1.899736   2.349141     0.81   0.420    -2.743517     6.54299
        {txt}IRAQ {c |}  {res}-3.506847   2.986247    -1.17   0.242    -9.409388    2.395693
       {txt}_cons {c |}  {res} 10.79491   2.902668     3.72   0.000     5.057571    16.53225
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mUS_Target_pred
{txt}(option xb assumed; fitted values)
(5 missing values generated)

{com}. line mUS_Target mUS_Target_pred Quarter
{res}{txt}
{com}. drop mUS_Target_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   144) ={res}    6.55
{txt}{col 13}Prob > F ={res}    0.0019
{txt}
{com}. 
. * Ljung-Box statistic Q(6) - testing H0: white noise(in residuals)--> the first 6 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(5 missing values generated)

{com}. wntestq resid, lags(6)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.2174
{txt} Prob > chi2({res}6{txt})            = {res}    0.9998
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. * 2 zero values --> need to find c using grid search ==> c=0.01
. gen ystar=mUS_Target
{txt}
{com}. replace ystar=0.01 if mUS_Target==0
{txt}(2 real changes made)

{com}. gen lmUS_Target=ln(ystar)
{txt}
{com}. nbreg mUS_Target L(1/5).lmUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-651.92836{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res} -651.8139{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-651.81388{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-609.11648{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-583.27455{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-582.10915{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-582.10871{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-582.10871{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-544.70683{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res} -533.5916{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-528.02604{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-527.95143{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-527.95142{txt}  

Negative binomial regression                      Number of obs   =  {res}      155
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}9{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-527.95142                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}  mUS_Target{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text} lmUS_Target{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .2126417{col 26}{space 2} .0840953{col 37}{space 1}    2.53{col 46}{space 3}0.011{col 55}{space 3} .0478179{col 67}{space 3} .3774654
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .2533826{col 26}{space 2} .0797537{col 37}{space 1}    3.18{col 46}{space 3}0.001{col 55}{space 3} .0970683{col 67}{space 3} .4096969
{col 1}{text}         L3.{col 14}{c |}{result}{space 2}-.0927996{col 26}{space 2} .0880807{col 37}{space 1}   -1.05{col 46}{space 3}0.292{col 55}{space 3}-.2654345{col 67}{space 3} .0798354
{col 1}{text}         L4.{col 14}{c |}{result}{space 2}  .162784{col 26}{space 2} .0662974{col 37}{space 1}    2.46{col 46}{space 3}0.014{col 55}{space 3} .0328435{col 67}{space 3} .2927245
{col 1}{text}         L5.{col 14}{c |}{result}{space 2} .1451978{col 26}{space 2} .0757717{col 37}{space 1}    1.92{col 46}{space 3}0.055{col 55}{space 3}-.0033121{col 67}{space 3} .2937076
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .1134716{col 26}{space 2} .0915275{col 37}{space 1}    1.24{col 46}{space 3}0.215{col 55}{space 3}-.0659189{col 67}{space 3} .2928621
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.3362239{col 26}{space 2} .1242556{col 37}{space 1}   -2.71{col 46}{space 3}0.007{col 55}{space 3}-.5797605{col 67}{space 3}-.0926873
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .2548192{col 26}{space 2} .1979456{col 37}{space 1}    1.29{col 46}{space 3}0.198{col 55}{space 3}-.1331469{col 67}{space 3} .6427854
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .5011669{col 26}{space 2} .1896854{col 37}{space 1}    2.64{col 46}{space 3}0.008{col 55}{space 3} .1293904{col 67}{space 3} .8729434
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.3110843{col 26}{space 2} .2310157{col 37}{space 1}   -1.35{col 46}{space 3}0.178{col 55}{space 3}-.7638667{col 67}{space 3} .1416982
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.010388{col 26}{space 2} .2985901{col 37}{space 1}    3.38{col 46}{space 3}0.001{col 55}{space 3} .4251626{col 67}{space 3} 1.595614
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.875181{col 27}{space 1} .1709266{col 55}{space 3}-2.210191{col 67}{space 3}-1.540171
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .1533272{col 27}{space 1} .0262077{col 55}{space 3} .1096797{col 67}{space 3} .2143444
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mUS_Target]L.lmUS_Target = 0
{txt} ( 2)  {res}[mUS_Target]L2.lmUS_Target = 0
{txt} ( 3)  {res}[mUS_Target]L3.lmUS_Target = 0
{txt} ( 4)  {res}[mUS_Target]L4.lmUS_Target = 0
{txt} ( 5)  {res}[mUS_Target]L5.lmUS_Target = 0
{txt} ( 6)  {res}[mUS_Target]FUND = 0
{txt} ( 7)  {res}[mUS_Target]POST = 0
{txt} ( 8)  {res}[mUS_Target]SEPT = 0
{txt} ( 9)  {res}[mUS_Target]Dp = 0
{txt} (10)  {res}[mUS_Target]IRAQ = 0

           {txt}chi2( 10) ={res}  240.35
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mUS_Target_pred
{txt}(option n assumed; predicted number of events)
(5 missing values generated)

{com}. line mUS_Target mUS_Target_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mUS_Target]SEPT = 0
{txt} ( 2)  {res}[mUS_Target]Dp = 0

{txt}{col 12}chi2(  2) ={res}   32.21
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(6) - testing H0: white noise(in residuals)--> the first 6 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mUS_Target-mUS_Target_pred)/sqrt( mUS_Target_pred*(1+mUS_Target_pred*s2) )
{txt}(5 missing values generated)

{com}. wntestq nbresidual, lags(6)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.7794
{txt} Prob > chi2({res}6{txt})            = {res}    0.9388
{txt}
{com}. drop nbresidual mUS_Target_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mUS_Target L(1/5).lmUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  155{col 25}-582.1087{col 37}-527.9514{col 48}   11{col 57} 1077.903{col 69} 1111.381
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mUS_Target L(1/5).mUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  155{col 25}-608.4764{col 37}-573.5846{col 48}   10{col 57} 1167.169{col 69} 1197.604
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mUS_Target L(1/5).mUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  155{col 25}-582.1087{col 37}-539.9961{col 48}   11{col 57} 1101.992{col 69}  1135.47
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mUS_Target L(1/5).mUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  155{col 25}-912.6633{col 37}-681.8121{col 48}   10{col 57} 1383.624{col 69} 1414.058
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmUS_Target
{txt}
{com}. 
. *ITERATE
. sum iUS_Target

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
  iUS_Target {c |}{res}       160      24.925    18.58875          2        146
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iUS_Target, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-682.2641{col 48}    3{col 57} 1370.528{col 69} 1379.754
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-674.3926{col 48}    4{col 57} 1356.785{col 69} 1369.086
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-672.9803{col 48}    5{col 57} 1355.961{col 69} 1371.336
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -671.834{col 48}    6{col 57} 1355.668{col 69} 1374.119
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-671.6719{col 48}    7{col 57} 1357.344{col 69}  1378.87
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-671.4291{col 48}    8{col 57} 1358.858{col 69}  1383.46
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -671.419{col 48}    9{col 57} 1360.838{col 69} 1388.514
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-670.4864{col 48}   10{col 57} 1360.973{col 69} 1391.725
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(2) according to AIC and AR(2) according to BIC
. * Estimating AR(2)
. 
. regress iUS_Target L(1/2).iUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.2947
                                                       {txt}Root MSE      = {res}  16.03

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
  iUS_Target {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
  iUS_Target {c |}
         L1. {c |}  {res} .1486776    .139209     1.07   0.287    -.1263861    .4237414
         {txt}L2. {c |}  {res} .1972854   .1110559     1.78   0.078    -.0221505    .4167213
        {txt}FUND {c |}  {res}-4.324896   4.290176    -1.01   0.315    -12.80188    4.152086
        {txt}POST {c |}  {res}-8.391036   3.602885    -2.33   0.021       -15.51   -1.272077
        {txt}SEPT {c |}  {res} 3.853214   3.955634     0.97   0.332    -3.962745    11.66917
          {txt}Dp {c |}  {res}-11.82159   3.699497    -3.20   0.002    -19.13145   -4.511737
        {txt}IRAQ {c |}  {res}-8.354448   3.810001    -2.19   0.030    -15.88265   -.8262462
       {txt}_cons {c |}  {res} 23.21111   5.580877     4.16   0.000     12.18382    34.23839
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iUS_Target_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line iUS_Target iUS_Target_pred Quarter
{res}{txt}
{com}. drop iUS_Target_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}   11.49
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.2631
{txt} Prob > chi2({res}4{txt})            = {res}    0.8676
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. * No zero values --> no need to add c
. gen liUS_Target=ln(iUS_Target)
{txt}
{com}. nbreg iUS_Target L(1/2).liUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-920.84485{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-920.67427{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-920.67357{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-920.67357{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-669.85787{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-647.64151{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-645.93246{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-645.92915{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-645.92915{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-612.13672{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-602.96232{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-599.97803{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-599.97036{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-599.97036{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-599.97036                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}  iUS_Target{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text} liUS_Target{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .1850426{col 26}{space 2}  .095379{col 37}{space 1}    1.94{col 46}{space 3}0.052{col 55}{space 3}-.0018968{col 67}{space 3}  .371982
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .3023117{col 26}{space 2} .0716904{col 37}{space 1}    4.22{col 46}{space 3}0.000{col 55}{space 3} .1618011{col 67}{space 3} .4428223
{col 1}{text}        FUND{col 14}{c |}{result}{space 2}-.0280817{col 26}{space 2}   .13066{col 37}{space 1}   -0.21{col 46}{space 3}0.830{col 55}{space 3}-.2841705{col 67}{space 3} .2280071
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.3232896{col 26}{space 2} .1423795{col 37}{space 1}   -2.27{col 46}{space 3}0.023{col 55}{space 3}-.6023484{col 67}{space 3}-.0442309
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .2291177{col 26}{space 2} .1920798{col 37}{space 1}    1.19{col 46}{space 3}0.233{col 55}{space 3}-.1473517{col 67}{space 3} .6055871
{col 1}{text}          Dp{col 14}{c |}{result}{space 2}-1.024993{col 26}{space 2} .1760862{col 37}{space 1}   -5.82{col 46}{space 3}0.000{col 55}{space 3}-1.370115{col 67}{space 3}-.6798699
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.5743712{col 26}{space 2} .2008202{col 37}{space 1}   -2.86{col 46}{space 3}0.004{col 55}{space 3}-.9679715{col 67}{space 3}-.1807709
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.844056{col 26}{space 2} .3777384{col 37}{space 1}    4.88{col 46}{space 3}0.000{col 55}{space 3} 1.103702{col 67}{space 3}  2.58441
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.494513{col 27}{space 1} .1659599{col 55}{space 3}-1.819788{col 67}{space 3}-1.169237
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .2243579{col 27}{space 1} .0372344{col 55}{space 3}   .16206{col 67}{space 3} .3106037
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iUS_Target]L.liUS_Target = 0
{txt} ( 2)  {res}[iUS_Target]L2.liUS_Target = 0
{txt} ( 3)  {res}[iUS_Target]FUND = 0
{txt} ( 4)  {res}[iUS_Target]POST = 0
{txt} ( 5)  {res}[iUS_Target]SEPT = 0
{txt} ( 6)  {res}[iUS_Target]Dp = 0
{txt} ( 7)  {res}[iUS_Target]IRAQ = 0

           {txt}chi2(  7) ={res} 1765.96
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iUS_Target_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line iUS_Target iUS_Target_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iUS_Target]SEPT = 0
{txt} ( 2)  {res}[iUS_Target]Dp = 0

{txt}{col 12}chi2(  2) ={res}   74.20
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iUS_Target-iUS_Target_pred)/sqrt( iUS_Target_pred*(1+iUS_Target_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    4.0888
{txt} Prob > chi2({res}4{txt})            = {res}    0.3941
{txt}
{com}. drop nbresidual iUS_Target_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iUS_Target L(1/2).liUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-645.9292{col 37}-599.9704{col 48}    8{col 57} 1215.941{col 69} 1240.441
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iUS_Target L(1/2).iUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-686.0377{col 37}-658.4557{col 48}    7{col 57} 1330.911{col 69}  1352.35
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iUS_Target L(1/2).iUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-645.9292{col 37}-605.5912{col 48}    8{col 57} 1227.182{col 69} 1251.683
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iUS_Target L(1/2).iUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-1293.947{col 37}-963.2674{col 48}    7{col 57} 1940.535{col 69} 1961.973
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop liUS_Target
{txt}
{com}. 
. *** Casualty incidents with a U.S. Target                                                                                               
. 
. *MIPT
. sum mUSCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
 mUSCasualty {c |}{res}       160     4.41875    3.288003          0         16
{txt}
{com}. tab Quarter if mUSCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:2 {c |}{res}          1        6.25        6.25
{txt}     1969:1 {c |}{res}          1        6.25       12.50
{txt}     1969:2 {c |}{res}          1        6.25       18.75
{txt}     1969:4 {c |}{res}          1        6.25       25.00
{txt}     1971:4 {c |}{res}          1        6.25       31.25
{txt}     1972:3 {c |}{res}          1        6.25       37.50
{txt}     1973:1 {c |}{res}          1        6.25       43.75
{txt}     1978:3 {c |}{res}          1        6.25       50.00
{txt}     1987:1 {c |}{res}          1        6.25       56.25
{txt}     1997:2 {c |}{res}          1        6.25       62.50
{txt}     1999:4 {c |}{res}          1        6.25       68.75
{txt}     2000:1 {c |}{res}          1        6.25       75.00
{txt}     2000:3 {c |}{res}          1        6.25       81.25
{txt}     2007:2 {c |}{res}          1        6.25       87.50
{txt}     2007:3 {c |}{res}          1        6.25       93.75
{txt}     2007:4 {c |}{res}          1        6.25      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         16      100.00
{txt}
{com}. *No such incidents in numerous Qs makes it necessary to use Poisson estimation as well.
. *But first I'm trying OLS
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mUSCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-406.9625{col 48}    3{col 57} 819.9249{col 69} 829.1505
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-398.3202{col 48}    4{col 57} 804.6405{col 69} 816.9412
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-397.4622{col 48}    5{col 57} 804.9244{col 69} 820.3003
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-395.6906{col 48}    6{col 57} 803.3812{col 69} 821.8322
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-394.6766{col 48}    7{col 57} 803.3533{col 69} 824.8795
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-394.5496{col 48}    8{col 57} 805.0992{col 69} 829.7006
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-394.4681{col 48}    9{col 57} 806.9361{col 69} 834.6127
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-394.3562{col 48}   10{col 57} 808.7124{col 69} 839.4642
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(4) according to AIC and AR(2) according to BIC
. * Parsimonity --> estimating AR(2)
. 
. regress mUSCasualty L(1/2).mUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.2609
                                                       {txt}Root MSE      = {res} 2.8834

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
 mUSCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
 mUSCasualty {c |}
         L1. {c |}  {res} .1401902   .0951175     1.47   0.143     -.047753    .3281334
         {txt}L2. {c |}  {res} .2335405   .0962712     2.43   0.016     .0433177    .4237634
        {txt}FUND {c |}  {res} 1.609845   .6457566     2.49   0.014     .3338907    2.885798
        {txt}POST {c |}  {res} -1.72289   .6528902    -2.64   0.009    -3.012939   -.4328406
        {txt}SEPT {c |}  {res} 1.546757   .9097129     1.70   0.091      -.25075    3.344263
          {txt}Dp {c |}  {res} 2.661925   .8648489     3.08   0.002     .9530652    4.370784
        {txt}IRAQ {c |}  {res} .4859416   1.294357     0.38   0.708    -2.071584    3.043468
       {txt}_cons {c |}  {res} 2.016712    .485345     4.16   0.000     1.057716    2.975708
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mUSCasualty_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line mUSCasualty mUSCasualty_pred Quarter
{res}{txt}
{com}. drop mUSCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}   76.28
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.6262
{txt} Prob > chi2({res}4{txt})            = {res}    0.8041
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if mUSCasualty==0
{res}   16
{txt}
{com}. * 16 zero observations - grid search to find c ==> c= 0.01
. gen ystar=mUSCasualty
{txt}
{com}. replace ystar=0.01 if mUSCasualty==0
{txt}(16 real changes made)

{com}. gen lmUSCasualty=ln(ystar)
{txt}
{com}. nbreg mUSCasualty L(1/2).lmUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-385.39229{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-385.38649{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-385.38649{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res} -411.0205{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-394.62402{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-394.62377{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-394.62377{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res} -375.7119{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-371.43346{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-371.16891{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-371.16831{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-371.16831{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-371.16831                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text} mUSCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}lmUSCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .0972678{col 26}{space 2} .0368638{col 37}{space 1}    2.64{col 46}{space 3}0.008{col 55}{space 3} .0250161{col 67}{space 3} .1695195
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .0732325{col 26}{space 2} .0419238{col 37}{space 1}    1.75{col 46}{space 3}0.081{col 55}{space 3}-.0089366{col 67}{space 3} .1554016
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .3987999{col 26}{space 2} .1382775{col 37}{space 1}    2.88{col 46}{space 3}0.004{col 55}{space 3} .1277809{col 67}{space 3} .6698189
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.4884429{col 26}{space 2} .1456876{col 37}{space 1}   -3.35{col 46}{space 3}0.001{col 55}{space 3}-.7739854{col 67}{space 3}-.2029004
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .3937842{col 26}{space 2} .1982929{col 37}{space 1}    1.99{col 46}{space 3}0.047{col 55}{space 3} .0051373{col 67}{space 3} .7824311
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .3820795{col 26}{space 2} .1630315{col 37}{space 1}    2.34{col 46}{space 3}0.019{col 55}{space 3} .0625435{col 67}{space 3} .7016154
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2} .1929477{col 26}{space 2} .2088528{col 37}{space 1}    0.92{col 46}{space 3}0.356{col 55}{space 3}-.2163963{col 67}{space 3} .6022917
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.102069{col 26}{space 2} .1113327{col 37}{space 1}    9.90{col 46}{space 3}0.000{col 55}{space 3} .8838608{col 67}{space 3} 1.320277
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.721391{col 27}{space 1} .2825522{col 55}{space 3}-2.275183{col 67}{space 3}-1.167599
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .1788172{col 27}{space 1} .0505252{col 55}{space 3} .1027781{col 67}{space 3}  .311113
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mUSCasualty]L.lmUSCasualty = 0
{txt} ( 2)  {res}[mUSCasualty]L2.lmUSCasualty = 0
{txt} ( 3)  {res}[mUSCasualty]FUND = 0
{txt} ( 4)  {res}[mUSCasualty]POST = 0
{txt} ( 5)  {res}[mUSCasualty]SEPT = 0
{txt} ( 6)  {res}[mUSCasualty]Dp = 0
{txt} ( 7)  {res}[mUSCasualty]IRAQ = 0

           {txt}chi2(  7) ={res}  128.70
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mUSCasualty_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line mUSCasualty mUSCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mUSCasualty]SEPT = 0
{txt} ( 2)  {res}[mUSCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}   53.39
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mUSCasualty-mUSCasualty_pred)/sqrt( mUSCasualty_pred*(1+mUSCasualty_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    2.2306
{txt} Prob > chi2({res}4{txt})            = {res}    0.6934
{txt}
{com}. drop nbresidual mUSCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mUSCasualty L(1/2).lmUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-394.6238{col 37}-371.1683{col 48}    8{col 57} 758.3366{col 69} 782.8374
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mUSCasualty L(1/2).mUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-411.2891{col 37}-387.4046{col 48}    7{col 57} 788.8093{col 69} 810.2475
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mUSCasualty L(1/2).mUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-394.6238{col 37} -372.346{col 48}    8{col 57}  760.692{col 69} 785.1928
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mUSCasualty L(1/2).mUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25} -436.105{col 37}-388.3386{col 48}    7{col 57} 790.6771{col 69} 812.1153
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmUSCasualty
{txt}
{com}. 
. *ITERATE
. sum iUSCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
 iUSCasualty {c |}{res}       160     5.96875     3.78913          0         17
{txt}
{com}. tab Quarter if iUSCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1969:1 {c |}{res}          1       25.00       25.00
{txt}     1997:2 {c |}{res}          1       25.00       50.00
{txt}     1998:1 {c |}{res}          1       25.00       75.00
{txt}     2000:1 {c |}{res}          1       25.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          4      100.00
{txt}
{com}. *No such incidents in numerous Qs makes it necessary to use Poisson estimation as well.
. *But first I'm trying OLS
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iUSCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-437.4523{col 48}    3{col 57} 880.9045{col 69}   890.13
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-432.3516{col 48}    4{col 57} 872.7031{col 69} 885.0038
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-429.8214{col 48}    5{col 57} 869.6429{col 69} 885.0187
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}  -428.81{col 48}    6{col 57}   869.62{col 69} 888.0711
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -428.803{col 48}    7{col 57} 871.6061{col 69} 893.1323
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-428.4686{col 48}    8{col 57} 872.9373{col 69} 897.5387
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-427.8877{col 48}    9{col 57} 873.7753{col 69} 901.4519
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-425.8899{col 48}   10{col 57} 871.7798{col 69} 902.5315
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(4) according to AIC and AR(2) according to BIC
. * Parsimonity --> estimating AR(2)
. 
. regress iUSCasualty L(1/2).iUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.1323
                                                       {txt}Root MSE      = {res} 3.6108

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
 iUSCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
 iUSCasualty {c |}
         L1. {c |}  {res} .0627381   .0772157     0.81   0.418    -.0898328     .215309
         {txt}L2. {c |}  {res} .1935183   .0900042     2.15   0.033     .0156784    .3713582
        {txt}FUND {c |}  {res} .6206904   .7717144     0.80   0.422    -.9041441    2.145525
        {txt}POST {c |}  {res}-2.149399   .8415188    -2.55   0.012    -3.812161   -.4866378
        {txt}SEPT {c |}  {res} 2.657009   1.904945     1.39   0.165    -1.106981       6.421
          {txt}Dp {c |}  {res}-1.052063   1.913818    -0.55   0.583    -4.833585     2.72946
        {txt}IRAQ {c |}  {res}-.6675101   1.925855    -0.35   0.729    -4.472816    3.137796
       {txt}_cons {c |}  {res}  4.54203    .810142     5.61   0.000     2.941266    6.142793
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iUSCasualty_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line iUSCasualty iUSCasualty_pred Quarter
{res}{txt}
{com}. drop iUSCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}    5.18
{txt}{col 13}Prob > F ={res}    0.0067
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    3.2700
{txt} Prob > chi2({res}4{txt})            = {res}    0.5137
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if iUSCasualty==0
{res}    4
{txt}
{com}. * 4 zero observations - grid search to find c ==> c= 0.99
. gen ystar=iUSCasualty
{txt}
{com}. replace ystar=0.99 if iUSCasualty==0
{txt}(4 real changes made)

{com}. gen liUSCasualty=ln(ystar)
{txt}
{com}. nbreg iUSCasualty L(1/2).liUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-438.50368{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-438.50357{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-438.50357{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-453.89665{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-422.32173{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-422.28994{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-422.28992{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-412.21752{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-411.31662{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-411.30842{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-411.30842{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-411.30842                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text} iUSCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}liUSCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .0915603{col 26}{space 2} .0706721{col 37}{space 1}    1.30{col 46}{space 3}0.195{col 55}{space 3}-.0469546{col 67}{space 3} .2300751
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .1256831{col 26}{space 2} .0754368{col 37}{space 1}    1.67{col 46}{space 3}0.096{col 55}{space 3}-.0221703{col 67}{space 3} .2735365
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .1032711{col 26}{space 2} .1144442{col 37}{space 1}    0.90{col 46}{space 3}0.367{col 55}{space 3}-.1210354{col 67}{space 3} .3275776
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.4152359{col 26}{space 2} .1627464{col 37}{space 1}   -2.55{col 46}{space 3}0.011{col 55}{space 3} -.734213{col 67}{space 3}-.0962588
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .5168256{col 26}{space 2} .2941202{col 37}{space 1}    1.76{col 46}{space 3}0.079{col 55}{space 3}-.0596394{col 67}{space 3} 1.093291
{col 1}{text}          Dp{col 14}{c |}{result}{space 2}-.1475355{col 26}{space 2} .3014761{col 37}{space 1}   -0.49{col 46}{space 3}0.625{col 55}{space 3}-.7384179{col 67}{space 3} .4433468
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.1431182{col 26}{space 2} .2794677{col 37}{space 1}   -0.51{col 46}{space 3}0.609{col 55}{space 3}-.6908648{col 67}{space 3} .4046284
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.451524{col 26}{space 2} .1762433{col 37}{space 1}    8.24{col 46}{space 3}0.000{col 55}{space 3} 1.106093{col 67}{space 3} 1.796954
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.658926{col 27}{space 1} .2145745{col 55}{space 3}-2.079484{col 67}{space 3}-1.238368
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .1903433{col 27}{space 1} .0408428{col 55}{space 3} .1249947{col 67}{space 3}  .289857
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iUSCasualty]L.liUSCasualty = 0
{txt} ( 2)  {res}[iUSCasualty]L2.liUSCasualty = 0
{txt} ( 3)  {res}[iUSCasualty]FUND = 0
{txt} ( 4)  {res}[iUSCasualty]POST = 0
{txt} ( 5)  {res}[iUSCasualty]SEPT = 0
{txt} ( 6)  {res}[iUSCasualty]Dp = 0
{txt} ( 7)  {res}[iUSCasualty]IRAQ = 0

           {txt}chi2(  7) ={res}   46.08
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iUSCasualty_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line iUSCasualty iUSCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iUSCasualty]SEPT = 0
{txt} ( 2)  {res}[iUSCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}    8.93
{txt}{col 10}Prob > chi2 =  {res}  0.0115
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iUSCasualty-iUSCasualty_pred)/sqrt( iUSCasualty_pred*(1+iUSCasualty_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    4.0577
{txt} Prob > chi2({res}4{txt})            = {res}    0.3982
{txt}
{com}. drop nbresidual iUSCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iUSCasualty L(1/2).liUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-422.2899{col 37}-411.3084{col 48}    8{col 57} 838.6168{col 69} 863.1176
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iUSCasualty L(1/2).iUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-434.1629{col 37}-422.9501{col 48}    7{col 57} 859.9001{col 69} 881.3383
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iUSCasualty L(1/2).iUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-422.2899{col 37}  -410.58{col 48}    8{col 57}   837.16{col 69} 861.6608
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iUSCasualty L(1/2).iUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-463.0563{col 37}-437.2857{col 48}    7{col 57} 888.5714{col 69} 910.0096
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar liUSCasualty
{txt}
{com}. 
{txt}end of do-file

{com}. log close
       {txt}log:  {res}C:\Users\Piotr\Documents\Published\ISQ\Stata files\regressions\all countries.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res} 9 Jan 2011, 15:59:49
{txt}{.-}
{smcl}
{txt}{sf}{ul off}